package activiti;

import java.util.List;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.repository.Deployment;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * spring框架和activiti整合
 * @author Shea
 *
 */
public class SpringActiviti {
	/**
	 * 测试流程引擎通过spring框架配置整合
	 */
	@Test
	public void test(){
		//读取配置文件
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		//通过bean的id获得processEngin的流程引擎对象
		ProcessEngine processEngine = (ProcessEngine) context.getBean("processEngine");
		List<Deployment> list = processEngine.getRepositoryService().createDeploymentQuery().list();
		for (Deployment deployment : list) {
			System.out.println(deployment.getId()+"..."+ deployment.getName());
		}
	}
}	
